.docs-search-wrapper {
  position: relative;
  width: 500px;
  .d-icon {
    position: absolute;
    right: 0.75em;
    top: 25%;
    font-size: 1.5em;
    color: var(--primary-low-mid);
    pointer-events: none;
    @media screen and (max-width: 400px) {
      // Just decoration, remove on small screens
      display: none;
    }
  }
  .btn.clear-search {
    background-color: var(--secondary);
    color: var(--tertiary);
    font-size: 0.75em;
    position: absolute;
    right: 0.8em;
    text-transform: lowercase;
    top: 20%;
  }
}

.docs-search {
  align-items: center;
  background-color: var(--primary-very-low);
  display: flex;
  justify-content: center;
  padding: 1.5em 1em;
  @include breakpoint(mobile-extra-large, min-width) {
    // More breathing room on larger screens
    margin-bottom: 2em;
  }
  .docs-search-bar {
    height: 50px;
    margin-bottom: 0px;
    width: 100%;
  }
}
.docs-browse {
  display: flex;
  .loading-container {
    display: flex;
    flex-basis: 100%;
    padding: 0.625em 0 0.625em 0.625em;
  }
  .docs-results {
    display: flex;
    flex-direction: column;
    flex-basis: 100%;
    .result-count {
      padding-top: 15px;
      padding-left: 0.625em;
    }
  }
  .docs-filters {
    margin-top: 0.15em;
    flex: 0 1 20%;
    @include breakpoint(tablet, min-width) {
      padding-right: 2em;
    }
    // min-width on flex allows container to
    // be more narrow than content if needed
    min-width: 175px;
  }
  .docs-items {
    padding: 0.57em 1em 1em 0;

    a {
      color: var(--primary);
      white-space: nowrap;
    }

    h3 {
      font-size: $font-up-1;
    }

    .docs-item-count {
      margin-left: auto;
      color: var(--primary-high);
      font-size: $font-down-1;
    }

    .docs-item {
      display: flex;
      align-items: center;
      cursor: pointer;
      padding: 0.25em 0.5em;

      .d-icon {
        height: 1em;
        padding-bottom: 0.15em;
        margin-right: 0.25em;
        color: var(--primary-high);
        &.d-icon-plus {
          height: 0.75em;
          margin-right: 0.25em;
        }
      }
      &:hover {
        background: var(--highlight-medium);
      }
      &.selected:hover {
        background: var(--danger-low);
        .d-icon {
          color: var(--danger);
        }
      }
      .tag-id,
      .category-id {
        margin-right: 3px;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
    .selected {
      font-weight: bold;
    }
  }
  .docs-topic-list {
    flex-basis: 100%;

    th {
      min-width: 5em;

      &[role="button"] {
        cursor: pointer;
      }

      &:hover {
        background-color: var(--primary-low);
      }

      .d-icon {
        vertical-align: middle;
      }
    }

    .badge-wrapper .badge-category .category-name {
      // extra protection for ultra-long category names
      max-width: 30vw;
    }

    .discourse-tags {
      font-weight: normal;
      font-size: $font-down-1;
    }
    .docs-topic-link {
      color: var(--tertiary);
      cursor: pointer;
      display: inline-block;
      word-break: break-word;
      & > * {
        pointer-events: none;
      }
    }
  }
  .docs-topic {
    display: flex;
    flex-direction: column;
    .docs-nav-link {
      font-weight: 700;
      &.return {
        align-items: center;
        background: none;
        color: var(--tertiary);
        display: inline-flex;
        font-size: $font-down-1;
        justify-content: normal;
        padding: 0;
        &::before {
          content: "«";
          margin-right: 5px;
        }
      }
      &.more {
        font-size: $font-up-1;
        padding: 10px 0;
      }
    }
    .topic-content {
      padding-top: 10px;
      h1 {
        line-height: $line-height-medium;
      }
      .lightbox-wrapper img {
        max-width: 100%;
      }
      code,
      pre {
        // Prevent pre from being wider than viewport
        white-space: pre-wrap;
        word-break: break-word;
      }
    }

    #share-link .reply-as-new-topic {
      display: none;
    }
  }
}

.docs-items {
  .item-controls {
    display: flex;
    justify-content: space-between;
    .btn {
      background-color: transparent;
      padding: 0.25em;
      svg {
        color: var(--primary-high);
      }
      &:hover,
      &.active {
        background-color: var(--secondary-very-high);
        svg {
          color: var(--primary-high);
        }
      }
      height: 28px;
    }
  }
}

.docs-items {
  input {
    width: 100%;
  }
  ul {
    margin: 0;
    list-style: none;
  }
}

@media print {
  .archetype-docs-topic {
    #main > div {
      grid-template-columns: 0 1fr;
    }
    .has-sidebar,
    .docs-search,
    .alert,
    .docs-filters,
    #skip-link {
      display: none;
    }
    .docs-topic {
      .docs-nav-link.return,
      .docs-nav-link.more {
        display: none;
      }
    }
  }
}
